#include "sd_log.h"

FILE* g_LogErrFile = NULL;
FILE* g_LogFile = NULL;


sd_Ret sd_log_err(const char* fmt,...)
{
	va_list args;
	va_start(args, fmt);
	if (g_LogErrFile == NULL)
		vfprintf(stderr, fmt, args);
	else
		vfprintf(g_LogErrFile, fmt, args);
	va_end(args);
	return SD_RET_OK;
}

sd_Ret sd_log(const char* fmt,...)
{
	va_list args;
	va_start(args, fmt);
	if (g_LogFile == NULL)
		vfprintf(stdout, fmt, args);
	else
		vfprintf(g_LogFile, fmt, args);
	va_end(args);
	
	return SD_RET_OK;
}

